package sctu.edu.java.year2016.team01.zhuming.day20160605.practice;

import java.net.ConnectException;
import java.sql.Connection;
import java.util.ArrayList;
import java.util.Collections;
import java.util.ListIterator;

/**
 * Created by Administrator on 2016/6/11.
 */
public class ListIteratorDome {
    public static void main(String[] args) {
        ArrayList array=new ArrayList();
       Collections.addAll(array,9,8,7,6,5,4,3,2,1);
        System.out.println("集合中的元素是：" + array);
        ListIterator it=array.listIterator();
        boolean hasnext=it.hasNext();
        System.out.println("集合中是否有下一个元素："+hasnext);
        boolean previous=it.hasPrevious();
        System.out.println("集合中是否有前一个元素:"+previous);

        System.out.println("集合下一个元素是："+it.next());
        while(it.hasNext())
            System.out.println("    "+it.next());
    }
}
